home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d2 / stpfcb13.arc / STOPFCBS.BAS < prev    next >
BASIC Source File  |  1991-06-08  |  5KB  |  144 lines

  1. ' STOPFCBS is Copyright 1991 by Alex Boge
  2.  
  3. ' Version 1.00  May 9, 1991
  4. ' Version 1.01  May 10, 1991 - Remove Deinstall functions, remove help,
  5. '  check to see if SHARE was loaded before installing, trap more functions and
  6. '  compile for 286 or better only.
  7. ' Version 1.10  May 23, 1991 - YIPES, big boo-boo.  Program was developed
  8. '  and tested under 4DOS instead of COMMAND.COM, so I didn't "know" that
  9. '  COMMAND.COM uses FCB functions 13h & 17h.  Had to drop these!
  10. ' Version 1.20  May 27, 1991 - STOPFCBS now uses Int 2Fh to return true for
  11. '  installed state of SHARE.  This prevents multiple installs of STOPFCBS
  12. '  and also prevents SHARE from being loaded afterwards.
  13.  
  14. ' Version 1.30  June 8, 1991 - STOPFCBS will now pass function 0Fh, Open
  15. '  File.  There is no harm in that alone and good reason to allow it.  Now
  16. '  programs like "COMP" and those that load overlays can still function.
  17. '  STOPFCBS will now stop additional functions 15h and 22h, these are the
  18. '  write to file using FCB functions, these are actually the ones that are
  19. '  most likely to cause problems.  I believe that this is now both the
  20. '  safest and friendliest method for STOPFCBS to function.
  21.  
  22.  
  23. ' This program stops INT 21H FCB-Oriented Functions 15H, 16H and 22H
  24. ' from causing harm to BIGDOS partitions.
  25.  
  26. ' Linked with BASIC PDS v7.10 and P.D.Q. 2.18 as follows:
  27. ' BC /O /G2 STOPFCBS;
  28. ' LINK /NOD /NOE STOPFCBS STR00256 _NOERROR _NOREAD _NOVAL,,NUL,BASIC7 PDQ;
  29.  
  30. DEFINT A-Z
  31.  
  32. TYPE RegType
  33.      AX        AS INTEGER
  34.      BX        AS INTEGER
  35.      CX        AS INTEGER
  36.      DX        AS INTEGER
  37.      BP        AS INTEGER
  38.      SI        AS INTEGER
  39.      DI        AS INTEGER
  40.      Flags     AS INTEGER
  41.      DS        AS INTEGER
  42.      ES        AS INTEGER
  43.      SS        AS INTEGER
  44.      SP        AS INTEGER
  45.      BusyFlag  AS INTEGER
  46.      Address   AS INTEGER
  47.      Segment   AS INTEGER
  48.      ProcAdr   AS INTEGER
  49.      ProcSeg   AS INTEGER
  50.      IntNum    AS INTEGER
  51. END TYPE
  52. DIM Registers21 AS RegType
  53. DIM Registers2F AS RegType
  54.  
  55. DECLARE SUB EndTSR (ID$)
  56. DECLARE SUB GotoOldInt (Registers AS RegType)
  57. DECLARE SUB IntEntry1 ()
  58. DECLARE SUB IntEntry2 (Registers AS RegType, Action%)
  59. DECLARE SUB Interrupt (IntNumber, Registers AS ANY)
  60. DECLARE SUB Pause (Ticks%)
  61. DECLARE SUB PDQPrint (Work$, Row%, Column%, Colr%)
  62. DECLARE SUB PointIntHere (Registers AS RegType)
  63. DECLARE SUB ReturnFromInt (Registers AS RegType)
  64.  
  65. ID$ = "STOPFCBS Version 1.30"
  66.  
  67. PRINT ID$ + " (C) 1991 by Alex Boge."
  68.  
  69.  
  70. Registers2F.AX = &H1000 ' AH=&h10, AL=&h00 - Function to test for SHARE
  71. Interrupt &H2F, Registers2F ' So we get it! (returned in AL)
  72. IF (Registers2F.AX AND &HFF) = &HFF THEN
  73.    PRINT "SHARE or STOPFCBS has already been installed.": END
  74. END IF
  75.  
  76. PRINT "STOPFCBS installed - Intercepting INT 21h functions 15h, 16h and 22h."
  77. IF INSTR(UCASE$(COMMAND$), "/Q") THEN
  78.    Verbose = 0
  79.    PRINT "Message line will be suppressed - beep will sound during an intercept."
  80. ELSE
  81.    Verbose = -1
  82.    Message$ = "« STOPFCBS has intercepted INT 21h FCB-Oriented function "
  83. END IF
  84.  
  85. Registers21.IntNum = &H21 'specify trapping Int 21h
  86. PointIntHere Registers21  'load Registers with what it needs, and pass
  87. GOTO Multiplex            '  control to the next line at each Int. 21h
  88.  
  89.  
  90. '----- the code below receives control with each Interrupt 21h
  91.  
  92. IntEntry1                       'this is the first mandatory step
  93. IntEntry2 Registers21, 0        'and this is the second one
  94.  
  95. Service = Registers21.AX \ 256  'get the current service number in AH
  96.  
  97. 'sequential write, create or random write file using FCB
  98. IF Service = &H15 OR Service = &H16 OR Service = &H22 THEN
  99.    BEEP 'make noise
  100.    IF Verbose THEN 'if we are allowed
  101.       DEF SEG = 0: V = PEEK(&H449): DEF SEG 'get video mode
  102.       IF V < 4 OR V = 7 THEN PDQPrint Message$ + HEX$(Service) + "h »", 1, 1, 15 'only in text mode
  103.       Pause 36 'pause about 2 seconds
  104.    END IF
  105.    IF Service=&H16 THEN
  106.       Registers21.AX = Service * 256 + &HFF 'return fail code
  107.    ELSE
  108.       Registers21.AX = Service * 256 + &H1 'return disk full status
  109.    END IF
  110.    ReturnFromInt Registers21 'finished
  111. ELSE
  112.    GotoOldInt Registers21 'on to original Int 21h if we're not trapping
  113. END IF
  114. '--- END Int 21h
  115.  
  116. Multiplex:
  117. Registers2F.IntNum = &H2F 'specify trapping Int 21h
  118. PointIntHere Registers2F  'load Registers with what it needs, and pass
  119. GOTO GoRes                '  control to the next line at each Int. 2Fh
  120.  
  121.  
  122. '----- the code below receives control with each Interrupt 2Fh
  123.  
  124. IntEntry1                       'this is the first mandatory step
  125. IntEntry2 Registers2F, 0        'and this is the second one
  126.  
  127. Proc = Registers2F.AX \ 256
  128. Func = Registers2F.AX AND 255
  129.  
  130. 'get installed state of SHARE:
  131. ' According to Programmers PC Source Book, Func=0, but real life shows
  132. ' that AL is &H80 so let's check for both to be safe
  133. IF Proc = &H10 AND (Func = 0 OR Func = &H80) THEN
  134.    Registers2F.AX = &H10FF 'indicate installed state
  135.    ReturnFromInt Registers2F 'finished
  136. ELSE
  137.    GotoOldInt Registers2F 'on to original Int 2Fh if we're not trapping
  138. END IF
  139. '----- END Int 2Fh
  140.  
  141. GoRes:
  142. EndTSR ID$  'terminate and stay resident
  143.  
  144.